package org.springframework;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;


public class ResourceTest {

	Logger log = LoggerFactory.getLogger(ResourceTest.class);

	@Test
	public void testPathMatchingResourcePatternResolver() throws Exception {
		// classpths*:和classpath:的区别
		// 在于classpath*:会去所有jar包中找，classpath:只会去当前jar包中找
		// 本质上默认支持了处理war: 和classpath*:（多资源）  还可以自定义
		//spring为我们提供了默认的PathMatchingResourcePatternResolver来获取resource资源
		PathMatchingResourcePatternResolver resolver
				= new PathMatchingResourcePatternResolver();
		Resource[] resources = resolver.getResources("classpath:META-INF/spring.handlers");
		log.info("resources.length:{}",resources.length);
		resources = resolver.getResources("classpath*:META-INF/spring.handlers");
		log.info("resources.length:{}",resources.length);
	}
}
